﻿package com.alipay.config;

import java.io.FileWriter;
import java.io.IOException;

/* *
 *类名：AlipayConfig
 *功能：基础配置类
 *详细：设置帐户有关信息及返回路径
 *修改日期：2017-04-05
 *说明：
 *以下代码只是为了方便商户测试而提供的样例代码，商户可以根据自己网站的需要，按照技术文档编写,并非一定要使用该代码。
 *该代码仅供学习和研究支付宝接口使用，只是提供一个参考。
 */

public class AlipayConfig {
	
//↓↓↓↓↓↓↓↓↓↓请在这里配置您的基本信息↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

	// 应用ID,您的APPID，收款账号既是您的APPID对应支付宝账号
	public static String app_id = "2018072460757246";
	
	// 商户私钥，您的PKCS8格式RSA2私钥
    public static String merchant_private_key = "MIIEvwIBADANBgkqhkiG9w0BAQEFAASCBKkwggSlAgEAAoIBAQDQPs8bx6BAHRINJiu2XazwGIM6tuXu9UTXV2RiOmfyAsH5ku+P0jKhV8XxDaNNKKMkHTkZ4Sxa8cL2d6p+7SbjKd5xOpNUPKTidwmrpICvzBGFYtQ4Uo0BOaKyMz7gHEM3d7DuKTqBKLDQIq/bbQyjDOup+VNhaySaQILt/iqR/zaW8/fMI23IMRyMGMKnVwRzay9+BmuUgdS7P70+0MqlzUInTCJDA3vbpJgJ5xlggXm491uE0dfQ4fQqHVBgPxdcpzfbXN7r4K6pe5FwKvbHXVVq9/QvKtSOGT4YiYwcNmhc8Y0dnYze0G0t9nbpiUSPzVa0hSJX/49q2atAO70FAgMBAAECggEBAIoww/tpU5x4Lhxvsh5It5R0j9EMwjT6qf5EziapH4Vn8xUNPtAv6s1Kk95M8IspZml2wwe7d1W6jWhFLO0hruacSDLXbiE+RSTLXa17crI2N4JOfQoLLescNi0O+LB70NckJFNHJL3FJOBZxF1WVkZ1MoYPIBfLo/SAzuHkApfyk+61fTARF1wEljZaXxw8UXlO/r+pQOOmKc1+7NBaH9crflLqvPKXaA/55TFRVhsWLipQuOfQzXDvXYDFLyE8UNB+jPQ0EuqeM/wXYwFxaxW3ay6VxYJ1eNhlOJ0rFqJB6cWWD0V72ln0R8DbDkuHtcNcWY/PXBPBenzFnRxGpAECgYEA6avkLoorbfpzU3mNlxKC79IRE12bnfEbpZQrBBmRHOVGjsp7MK8O6jZ4uvHt//pNFcRo3VjRjuduJNK5OwT0FeIUeo+N/vc92UL7AtvpDrTGuPXadyoL90L/qGbo53v+KKqdW5gTxs7DOGex/fvm6XzQ4nEbUbYthCFgpBMP3oUCgYEA5CTwtN6p0b3rQzK6Iptdn8mHpZUM73HLR9efNIFgmCoz89P/e4AguZUN+jNght9JU7Gxi43t3V5mGpGjih3ytZYgFlFY2H/U0UQzKvDcJqNzLnPEeTdNZQvqMXUwBoJKPM2tmlx900Lb/1rA2HANsVbPB3hBkHm2jZlQwP/S7IECgYEAsV5qm/EBOj/LXmd71FqWzRc1IvAA+YhUpgCsDjah8b8PKcAEdlXLCnlCdxTAxXbnIEiwGKQcnU6KSqUxON1vsVSkmstwy0I8zjeLdQYcB6+s0CS+KYne/1b53IgQ7fUuXQv02du710KG6L+9Wb7l7gFyRQ/53rJcJll3k9NsTkkCgYEAr33q2nZc0sXwbmRa4bv5LKxs92XL6XPzFnQ6Nr0+fE4aYHi2kV1hzt9lPQzAN38SfJq3I84tJpcym0VkMx4OULgGPqScXw0Vu1NmuKVF80LPmu/aNhPgKNYdc6XdJ2SZjmP4IkD7WMKZT7eTl+m53qwT3H8Yj/XQAuPoRk2DBgECgYBb2lz69Qq3/Myf1lx8MALF41+74i7bcaURvmrISuqEr8nDPdkME4tUhy7BNSv4mI8jc4lBe/1gdMbOjrKe/kGxJKSiZriClKyskTe3K0+oGrWzoqpYRqFbt+jz+0FrJzYt80EJAMNZaK3TpgXhoSzR/yJ0OYZxgAhLdMftHCsz3g==";
	
	// 支付宝公钥,查看地址：https://openhome.alipay.com/platform/keyManage.htm 对应APPID下的支付宝公钥。
    public static String alipay_public_key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAm2r0MXbXNf3z8yDPddql6A/xnMuRQUOD/t/4/JdkB/tscOt3m1OJIXR88YL1KTL3NBzgBEg5rjIYbkl5wKjkednZDbniuRTSM3UkPwbuwluLxmQVWox6eZ6sz4lSrNQXk9UGSsjREEvzr7760T+6GJt6pAZIqk0CIoDWo6I6yQZTY2pi4Nkbt7FDBllcE5sFqAlInbc7TcXxedG/uVchaic58iy0D2P9vVZzxEbJQpmFboWayob/4ZdudLXzlj2Rh82lHvPEpdLmyaNSaXSN7qJkRfDvKnJK96kWe8nKWrKGZupwXNv9kTznbt32jahONzvNvBeftDPR09x07/a6/QIDAQAB";

	// 服务器异步通知页面路径  需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
	public static String notify_url = "http://222.223.206.166:8888/web/notify_url.jsp";

	// 页面跳转同步通知页面路径 需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
	public static String return_url = "http://222.223.206.166:8888/web/return_url.jsp";

	// 签名方式
	public static String sign_type = "RSA2";
	
	// 字符编码格式
	public static String charset = "utf-8";
	
	// 支付宝网关
	public static String gatewayUrl = "https://openapi.alipay.com/gateway.do";
	
	// 支付宝网关
	public static String log_path = "D:\\";


//↑↑↑↑↑↑↑↑↑↑请在这里配置您的基本信息↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑

    /** 
     * 写日志，方便测试（看网站需求，也可以改成把记录存入数据库）
     * @param sWord 要写入日志里的文本内容
     */
    public static void logResult(String sWord) {
        FileWriter writer = null;
        try {
            writer = new FileWriter(log_path + "alipay_log_" + System.currentTimeMillis()+".txt");
            writer.write(sWord);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (writer != null) {
                try {
                    writer.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}

